package com.oscarmovie.model;

import java.util.Date;

public class Video implements Comparable<Video>{
	private int id;
	private String name;//正片 预告片 花絮 拍摄记录片
	private String url;	
	private String provider;
	private String length;//格式灵活，120分钟，2:00, 2:10:22
	private int type;//0:标清，1：高清，2：超清
	private String format;//16:9, 4:3, xxxx
	private Movie movie;
	
	private Language dialogLanguage;
	private Language subtitleLanguage;
	private String displayName;		
	private String data;
	private Image image;
	
	private Account account;
	private Date datetime;
	public String getDisplayName() {
		if (displayName == null) {
			displayName = name;			
		}
		return displayName;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	
	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}
	/**
	 * @param url the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}
	
	public void setName(String name) {
		this.name = name;
	}
		
	
	/**
	 * @return the provider
	 */
	public String getProvider() {
		return provider;
	}
	/**
	 * @param provider the provider to set
	 */
	public void setProvider(String provider) {
		this.provider = provider;
	}
	public void setMovie(Movie movie) {
		this.movie = movie;
	}
	public Movie getMovie() {
		return movie;
	}
	public void setSubtitleLanguage(Language subtitleLanguage) {
		this.subtitleLanguage = subtitleLanguage;
	}
	public Language getSubtitleLanguage() {
		return subtitleLanguage;
	}
	public void setDialogLanguage(Language dialogLanguage) {
		this.dialogLanguage = dialogLanguage;
	}
	public Language getDialogLanguage() {
		return dialogLanguage;
	}
	
	public void setLength(String length) {
		this.length = length;
	}
	public String getLength() {
		return length;
	}
	public void setImage(Image image) {
		this.image = image;
	}
	public Image getImage() {
		return image;
	}
	
	public int hashCode() {
		return this.id;
	}
	public boolean equals(Object object) {
		boolean t = false;
		if (object != null) {
			Video video = (Video) object;
			t = video.getId() == this.getId();
		}
		return t;
	}
	public void setData(String data) {
		this.data = data;
	}
	public String getData() {
		return data;
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getType() {
		return type;
	}
	public void setFormat(String format) {
		this.format = format;
	}
	public String getFormat() {
		return format;
	}
	
	public String getTypeName(){
		String typeName = "";
		if(type==1){
			typeName="标清";
		} else if(type==2){
			typeName="高清";
		} else if(type==3){
			typeName="超清";
		}
		return typeName;
	}
	/* (non-Javadoc)
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 */
	public int compareTo(Video o) {
		if (this.id < o.id) return -1;
		else if (this.id == o.id) return 0;
		else return 1;		
	}
	public void setAccount(Account account) {
		this.account = account;
	}
	public Account getAccount() {
		return account;
	}
	public void setDatetime(Date datetime) {
		this.datetime = datetime;
	}
	public Date getDatetime() {
		return datetime;
	}

}
